import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [
  {
    path:'/login',
    name:'login',
    component:() => import('@/views/login/login')
  },
  {
    path: '/',
    name: 'layout',
    component: () => import('@/views/layout/index'),
    children:[
      {
        path: '', //默认子路由
        name: 'home',
        component: () => import('@/views/home/home')
      },
      {
        path: '/qa',
        name: 'qa',
        component: () => import('@/views/qa/qa')
      },
      {
        path: '/video',
        name: 'video',
        component: () => import('@/views/video/video')
      },
      {
        path: '/my',
        name: 'my',
        component: () => import('@/views/my/my')
      },
    ]
  },
  {
    path:'/search',
    name:'search',
    component:()=>import('@/views/search/index')
  },
  {
    path: '/article/:articleId',
    name: 'article',
    component: () => import('@/views/article/index'),
    props:true
  },
  {
    path:'/user/profile',
    name:'user-profile',
    component:()=>import('@/views/user-profile/index')
  },
  {
    path: '/user/chat',
    name: 'user-chat',
    component: () => import('@/views/user-chat/index')
  }
]

const router = new VueRouter({
  routes
})

export default router
